package com.lxp.ssh2.web.interceptor;

import com.lxp.ssh2.web.Constents;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class AuthenticationInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		String loginUser = (String) ActionContext.getContext().getSession().get(Constents.CURRENT_USER);
		if(loginUser == null) {
			ActionContext.getContext().getSession().put("noLogin", "您还没有登录，请登录");
			return "signin";
		}
		
		return invocation.invoke();
	}

}
